package cn.myzf.ftp.cogradient.netty.utils;

import java.util.HashMap;
import java.util.Map;

/**
 * @package cn.myzf.ftp.download.netty
 * @Date Created in 2019/12/27 10:53
 * @Author myzf
 */
public class PropertiesUtil {

    private static Map<String, String> map = new HashMap<>();
    private static PropertiesLoader loader = new PropertiesLoader(new String[]{"application.properties"});

    public static String getConfig(String key) {
        String value = map.get(key);
        if (value == null) {
            value = loader.getProperty(key);
            map.put(key, value != null ? value : "");
        }
        return value;
    }

    public static Boolean isDebug() {
        String debug = getConfig("web.debug");
        return "true".equals(debug);
    }

}
